package cn.swing.his.hospitalization.webapi.impl;

import cn.swing.his.hospitalization.service.IOhospitalizationService;
import cn.swing.his.hospitalization.webapi.mapper.HospitalizationMapper;
import cn.swing.his.pojo.hospitalization.dto.HospitalBedsDetailsDTO;
import cn.swing.his.pojo.hospitalization.vo.BedByPatientVO;
import cn.swing.his.pojo.hospitalization.vo.HospitalBedsVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author chenqi
 */
@Service
@Slf4j
public class HospitalizationServiceImpl implements IOhospitalizationService {

    @Autowired
    HospitalizationMapper hospitalizationMapper;

    /**
     * 新增一个或多个病床
     * @param hospitalBedsDetailsDTO
     * @return
     */
    @Override
    public Integer insertHospitalBeds(HospitalBedsDetailsDTO hospitalBedsDetailsDTO){
        return hospitalizationMapper.insertHospitalBeds(hospitalBedsDetailsDTO);
    }

    /**
     * 根据id删除床位信息
     * @param id
     * @return
     */
    @Override
    public Integer deleteHospitalBedsById(Integer id){ return hospitalizationMapper.deleteHospitalBedsById(id); }

    /**
     * 根据患者id删除床位信息
     * @param patientId
     * @return
     */
    @Override
    public Integer deleteHospitalBedsByPatientId(Integer patientId){ return hospitalizationMapper.deleteHospitalBedsByPatientId(patientId); }

    /**
     * 根据id查询病床信息
     * @return 返回病床信息
     */
    @Override
    public List<HospitalBedsVO> getAllHospitalBeds() {
        return hospitalizationMapper.getAllHospitalBeds();
    }

    /**
     * 根据病房号查询病床信息
     * @param wardId
     * @return 返回病床信息
     */
    @Override
    public List<HospitalBedsVO> getHospitalBedsByWard(Integer wardId){
        return hospitalizationMapper.getHospitalBedsByWard(wardId);
    }

    /**
     * 根据病床状态查询病床信息
     * @param state
     * @return 返回病床信息
     */
    @Override
    public List<HospitalBedsVO> getHospitalBedsByState(Integer state){
        return hospitalizationMapper.getHospitalBedsByState(state);
    }

    /**
     * 根据患者ID查询病床信息
     * @param patientId
     * @return 返回病床号
     */
    @Override
    public BedByPatientVO getHospitalBedsByPatientId(Integer patientId){
        return hospitalizationMapper.getHospitalBedsByPatientId(patientId);
    }
}
